// StatOptionDlg.cpp : implementation file
//

#include "stdafx.h"
#include "kwclientcore.h"
#include "StatOptionDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CStatOptionDlg dialog


CStatOptionDlg::CStatOptionDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CStatOptionDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CStatOptionDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
  m_dwMask = 0;
}


void CStatOptionDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CStatOptionDlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CStatOptionDlg, CDialog)
	//{{AFX_MSG_MAP(CStatOptionDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CStatOptionDlg message handlers

BOOL CStatOptionDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
  for (int i = IDC_STATOPTION_OPTION0;i <= IDC_STATOPTION_OPTION10;i++)
  {
    CheckDlgButton(i, m_dwMask&(1<<(i-IDC_STATOPTION_OPTION0)));
  }
  CheckDlgButton(IDC_STATOPTION_OPTION31, m_dwMask&0x80000000);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CStatOptionDlg::OnOK() 
{
	// TODO: Add extra validation here
  m_dwMask = 0;
  for (int i = IDC_STATOPTION_OPTION0;i <= IDC_STATOPTION_OPTION10;i++) 
  {
    m_dwMask |= (DWORD)((IsDlgButtonChecked(i) != 0)<<(i-IDC_STATOPTION_OPTION0));
  }
  m_dwMask |= (DWORD)((IsDlgButtonChecked(IDC_STATOPTION_OPTION31) != 0)<<31);

	CDialog::OnOK();
}
